//批量修改折扣率对话框
function showUptDiscountDialog(){
	var strMsg1 = getLanMsg("0ec22190-000147");
	var strMsg2 = getLanMsg("0ec22190-000148");
	var strMsg3 = getLanMsg("0ec22190-000149");
	var strContent = "";
	strContent = strContent + "<div style='width:300px;margin-left:150px;margin-bottom:10px;'>";
	strContent = strContent + "		<span>" + strMsg1 + "  </span>";
	strContent = strContent + "		<input type='text' id='update_discount' name='update_discount' onchange='subReduNum(this,2);' onkeypress='javascript:keyPress(this,event);' value='' />";
	strContent = strContent + "</div>";
	strContent = strContent + "<div id='update_msg' name='update_msg' style='margin-left:30px;color:red'>";
	strContent = strContent + " </div>";
	seajs.use('common/dialog/src/js/dialog_ec',
		function(dialog) {
			dialog.confirm({
				type:"confirm",
				title:strMsg2,
				isHtmlContent:true,
				confirm:function(){
					var objDiscount = document.getElementById("update_discount");
					var strDiscount = objDiscount.value;
					if(strDiscount == null || strDiscount == ""){
						$("#update_msg").html(strMsg3);
						return;
					}
					updateDiscount(objDiscount);
					return true;
				},
				content:strContent
			});
		});
}

//批量修改折扣率
function updateDiscount(obj){			   
	var val = document.getElementById("update_discount").value;
	var objDiscount =parent.document.getElementsByName("discount");
	if(objDiscount != null){
		for(var i=0; i<objDiscount.length; i++){
			objDiscount[i].value = val;
			doCalPrice("discount_rate",i+1);				
		}				
	}
}

//批量修改税率对话框
function showUptTaxrateDialog(){
	var strMsg1 = getLanMsg("0ec22190-000150");
	var strMsg2 = getLanMsg("0ec22190-000151");
	var strMsg3 = getLanMsg("0ec22190-000152");
	var strContent = "";
	strContent = strContent + "<div style='width:300px;margin-left:150px;margin-bottom:10px;'>";
	strContent = strContent + "		<span>" + strMsg1 + "  </span>";
	strContent = strContent + "		<input type='text' id='update_taxrate' name='update_taxrate' onchange='subReduNum(this,2);' onkeypress='javascript:keyPress(this,event);' value='' />";
	strContent = strContent + "</div>";
	strContent = strContent + "<div id='update_msg' name='update_msg' style='margin-left:30px;color:red'>";
	strContent = strContent + "</div>";
	seajs.use('common/dialog/src/js/dialog_ec',
		function(dialog) {
			dialog.confirm({
				type:"confirm",
				title:strMsg2,
				isHtmlContent:true,
				confirm:function(){
					var objTaxrate = document.getElementById("update_taxrate");
					var strTaxrate = objTaxrate.value;
					if(strTaxrate == null || strTaxrate == ""){
						$("#update_msg").html(strMsg3);
						return;
					}
					updateTaxrate();
					return true;
				},
				content:strContent
			});
		});
}

//批量修改税率
function updateTaxrate(){			   
	var val = document.getElementById("update_taxrate").value;
	var objTaxRate = document.getElementsByName("rate");
	if(objTaxRate != null){
		for(var i=0; i<objTaxRate.length; i++){
			objTaxRate[i].value = val;
			doCalPrice("tax_rate",i+1);			
		}				
	}
}